package 找出所有子集的异或总和再求和;

class Solution {
    int ret;
    public int subsetXORSum(int[] nums) {
        dfs(nums, 0, 0);
        return ret;
    }

    public void dfs(int[] nums, int pos, int sum){
        ret += sum;
        for(int i = pos; i < nums.length; i++){
            sum ^= nums[i];
            dfs(nums, i + 1, sum);
            sum ^= nums[i];
        }
    }
}